/*
CUNY - GMapper
Software Design Lab
CSC 22100 - Spring 2011

TEAM 9:
Ariel Teferici
Ivan Tse
Michael Cheong

SVN Repository:
http://code.google.com/p/cuny-gmapper/
 */
package com.macavelly.com;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import com.google.android.maps.GeoPoint;

import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.text.Editable;

public class geocode {
	private Context gContext;
	private List<Address> geoloc;
	private GeoPoint p;

	public geocode(String addy, Context context){
		gContext = context;
		Geocoder geocodeaddy = new Geocoder(gContext, Locale.US);
		try {
			geoloc = geocodeaddy.getFromLocationName(addy, 5);
			Address x = geoloc.get(0);
			int lat = (int) (x.getLatitude() * 1000000);
			int lon = (int) (x.getLongitude() * 1000000);
			p = new GeoPoint(lat,lon);		
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
	
	public GeoPoint getPoint(){
		return p;

	}

}
